var return_top = document.getElementById("return_top");
var sTop;
window.onscroll = function(){

    sTop = document.body.scrollTop||document.documentElement.scrollTop;
    if(sTop>300){
        return_top.className = "return-top active";
    }else{
        return_top.className = "return-top";
    }
}

return_top.onclick = function(){
    var termId = setInterval(function(){
        sTop-=50;
        if(sTop<=0){

            clearInterval(termId);
        }
        window.scrollTo(0,sTop);

    },1);       
}